package ch.fusun.baron.farm;

import java.util.Map;

import ch.fusun.baron.core.injection.Inject;
import ch.fusun.baron.data.DataUpdate;
import ch.fusun.baron.map.Tile;

/**
 * @author dezanets
 * 
 */
public class FarmDataUpdate implements DataUpdate {

	private Map<Tile, Farm> farmMap;

	@Inject
	private transient FarmService farmService;

	/**
	 * Kryonet constructor
	 */
	public FarmDataUpdate() {
	}

	/**
	 * @param cityMap
	 *            the whole city map
	 */
	public FarmDataUpdate(Map<Tile, Farm> cityMap) {
		this.farmMap = cityMap;
	}

	@Override
	public void update() {
		for (Tile tile : farmMap.keySet()) {
			farmService.setFarm(tile, farmMap.get(tile));
		}
	}

}
